package com.hevery.validator;

import org.springframework.web.bind.annotation.ControllerAdvice;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @Author: Hevery
 * @Description:
 * @Date: Created on 2017/10/7
 * @Modified By:
 */
@Target({ElementType.FIELD,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
/** 标示当前的注解需要某个类进行校验，如果要想使用Hibernate Validator注解，必须在注解里面声明message，groups，payload*/
@Constraint(validatedBy = MyConstraintValidator.class)
public @interface MyConstraint {
    String message() ;

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
